//
//  PerfectContentViewController.m
//  SHHCPhone
//
//  Created by sheng long on 14-6-18.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "PerfectContentViewController.h"
#import "PerfectContentView.h"
#import "PerfectContentTwoViewController.h"

@interface PerfectContentViewController ()<PerfectContentViewDelegate>

@end

@implementation PerfectContentViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    navigationBarView.title = @"完善资料";
    [navigationBarView setNormalLeftButton];
    
    PerfectContentView *view = [[PerfectContentView alloc] initWithFrame:CGRectMake(0, NAVIGATIONBAR_HEIGHT, CURRENT_CONTENT_WIDTH, CURRENT_CONTENT_HEIGHT-NAVIGATIONBAR_HEIGHT)];
    [view setUIVC:self];
    [view setDelegate:self];
    [self.view addSubview:view];
}

-(void)leftButtonClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

#pragma mark - PerfectContentViewDelegate
-(void)done:(NSDictionary *)dic
{
//    PerfectContentTwoViewController *vc = [[PerfectContentTwoViewController alloc] init];
//    [self.navigationController pushViewController:vc animated:YES];
//    return;
    [LoadingFrameView showLoadingview];
    [self superASIStartAsynchronous:[NetUtls httpPost:self withValue:dic tag:IOS_COMPLETE_TAG need:YES]];
}

#pragma mark - ASIHTTPRequestDelegate
-(void)requestFinished:(ASIHTTPRequest *)request
{

}

-(void)requestFailed:(ASIHTTPRequest *)request
{
    CLog(@"%@",[request responseString]);
    [LoadingFrameView autoDisappearBlockingview:@"完善资料失败"];
}

-(void)getASIRecordSucceed:(ASIHTTPRequest *)request data:(NSDictionary *)dic
{
    CLog(@"获取数据成功");
    UserMsg *info = [[UserMsg alloc] init:dic];
    if (APP_USER_MSG.phone.length > 0) {
        info.phone = APP_USER_MSG.phone;
    }
    APP_USER_MSG = info;
    [LoadingFrameView directlyDisappear];
    [self.navigationController pushViewController:[[PerfectContentTwoViewController alloc] init] animated:YES];
}

-(void)getASIRecordFailed:(ASIHTTPRequest *)request data:(NSString *)failed
{
    [LoadingFrameView autoDisappearBlockingview:failed];
}

@end
